

package jetbrains.buildServer.server.rest.data.locator;


import org.jetbrains.annotations.NotNull;

/**
 * Describes a syntax of the full locator or one of it's {@link Dimension}s.
 * May represent a simple or a complex value, see {@link PlainValue} and {@link SubDimensionSyntax}.
 */
public interface Syntax {
  String getFormat();

  static NamedLocator forLocator(@NotNull String locatorName) {
    return new NamedLocator(locatorName);
  }

  static TODO TODO(@NotNull String msg) {
    return new TODO(msg);
  }

  class TODO implements Syntax {
    private final String myFormatDescription;

    public TODO(@NotNull String formatDescription) {
      myFormatDescription = formatDescription;
    }

    @Override
    public String getFormat() {
      return myFormatDescription;
    }
  }

  class NamedLocator implements Syntax {
    private final String myLocatorName;
    NamedLocator(@NotNull String locatorName) {
      myLocatorName = locatorName;
    }

    @Override
    public String getFormat() {
      return myLocatorName;
    }
  }
}